package com.ruibang.glass.produce.controller.system;

import com.ruibang.glass.produce.domain.req.UniformityMixtureReq;
import com.ruibang.glass.produce.domain.resp.DefectAnalysisAnnotation;
import com.ruibang.glass.produce.domain.resp.Hot2DefectAnalysisChart;
import com.ruibang.glass.produce.service.Hot2DefectAnalysisService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-05-29  09:51
 * @Description: TODO
 * @Version: 1.0
 */

@Api(tags = "热端2缺陷趋势分析")
@RestController
@RequestMapping("/api/glass/produce/Hot2DefectAnalysis")
@Validated
public class Hot2DefectAnalysisController {

    @Autowired
    private Hot2DefectAnalysisService hot2DefectAnalysisService;


    @PostMapping("/defectAnalysisChart")
    @ApiOperation(value = "折线图", notes = "折线图")
    public ResultBody<Hot2DefectAnalysisChart> defectAnalysisChart(@RequestBody UniformityMixtureReq uniformityMixtureReq) {
        return ResultBody.success(hot2DefectAnalysisService.defectAnalysisChart(uniformityMixtureReq));
    }

    @PostMapping("/saveAnnotation")
    @ApiOperation(value = "保存批注", notes = "保存批注")
    public ResultBody saveAnnotation(@RequestBody @Valid DefectAnalysisAnnotation defectAnalysisAnnotations) {
        hot2DefectAnalysisService.saveAnnotation(defectAnalysisAnnotations);
        return ResultBody.success();
    }

    @PostMapping("/queryAnnotation")
    @ApiOperation(value = "查询批注", notes = "查询批注")
    public ResultBody getAnnotation(@RequestBody UniformityMixtureReq uniformityMixtureReq) {
        return ResultBody.success(hot2DefectAnalysisService.queryAnnotation(uniformityMixtureReq));
    }

    @DeleteMapping("/deleteById/{id}")
    @ApiOperation(value = "删除批注", notes = "删除批注")
    public ResultBody deleteById(@PathVariable String id) {
        hot2DefectAnalysisService.deleteById(id);
        return ResultBody.success();
    }
}
